
const polyv = require('../../utils/polyv.js');

Page({
    data: {
        videoSrc: null,
        vid: '',
        title: '',
        isShow: false
    },
    timeUpdate: function (e) {
        polyv.timeUpdate(e);
    },
    onReady: function () {
        let that = this;
        let vid = that.data.vid;
        let video = ''
        let obj = {
            vid: vid,
            callback: function (videoInfo) {
                console.log(JSON.stringify(videoInfo))
                if (videoInfo.src.length == 1) {
                    video = videoInfo.src[0]
                } else {
                    video = videoInfo.src[1]
                }
                that.setData({
                    videoSrc: video,
                    title: videoInfo.title,
                    isShow: true
                });
                wx.hideLoading()
            }
        };
        polyv.getVideo(obj);
    },
    onLoad: function (options) {
        this.setData({
            vid: options.id
        })
        wx.showLoading({
            title: '加载中...'
        })
    }
})


